home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 4 code / A⁄ROSE / TaskSampleƒ / TaskSample.r < prev    next >
Encoding:
Text File  |  1990-07-01  |  5.2 KB  |  268 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    TaskSample.r
  4. #
  5. #    derived from MPW 3.1's "TaskSample", a MultiFinder-Aware Simple Sample Application
  6. #
  7. #   Demostrates how to port A/ROSE tasks to the MacOS under MultiFinder
  8. #
  9. #   Refer to the original source code in the MPW CExamples folder for more comments
  10. #
  11. #    Components:
  12. #                TaskSample.c
  13. #                TaskSample.r
  14. #                TaskSample.h
  15. #                TaskSample.make
  16. #
  17. ------------------------------------------------------------------------------*/
  18.  
  19.  
  20. #include "Types.r"
  21.  
  22. #include "TaskSample.h"
  23.  
  24.  
  25.  
  26. resource 'MBAR' (rMenuBar, preload) {
  27.     { mApple, mFile, mEdit, mSleep};
  28. };
  29.  
  30.  
  31. resource 'MENU' (mApple, preload) {
  32.     mApple, textMenuProc,
  33.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  34.     enabled, apple,
  35.     {
  36.         "About TaskSample…",
  37.             noicon, nokey, nomark, plain;
  38.         "-",
  39.             noicon, nokey, nomark, plain
  40.     }
  41. };
  42.  
  43. resource 'MENU' (mFile, preload) {
  44.     mFile, textMenuProc,
  45.     MenuItem12,                /* enable Quit only, program enables others */
  46.     enabled, "File",
  47.     {
  48.         "New",
  49.             noicon, "N", nomark, plain;
  50.         "Open",
  51.             noicon, "O", nomark, plain;
  52.         "-",
  53.             noicon, nokey, nomark, plain;
  54.         "Close",
  55.             noicon, "W", nomark, plain;
  56.         "Save",
  57.             noicon, "S", nomark, plain;
  58.         "Save As…",
  59.             noicon, nokey, nomark, plain;
  60.         "Revert",
  61.             noicon, nokey, nomark, plain;
  62.         "-",
  63.             noicon, nokey, nomark, plain;
  64.         "Page Setup…",
  65.             noicon, nokey, nomark, plain;
  66.         "Print…",
  67.             noicon, nokey, nomark, plain;
  68.         "-",
  69.             noicon, nokey, nomark, plain;
  70.         "Quit",
  71.             noicon, "Q", nomark, plain
  72.     }
  73. };
  74.  
  75. resource 'MENU' (mEdit, preload) {
  76.     mEdit, textMenuProc,
  77.     NoItems,                /* disable everything, program does the enabling */
  78.     enabled, "Edit",
  79.      {
  80.         "Undo",
  81.             noicon, "Z", nomark, plain;
  82.         "-",
  83.             noicon, nokey, nomark, plain;
  84.         "Cut",
  85.             noicon, "X", nomark, plain;
  86.         "Copy",
  87.             noicon, "C", nomark, plain;
  88.         "Paste",
  89.             noicon, "V", nomark, plain;
  90.         "Clear",
  91.             noicon, nokey, nomark, plain
  92.     }
  93. };
  94.  
  95. resource 'MENU' (mSleep, preload) {
  96.     mSleep, textMenuProc,
  97.     allEnabled,
  98.     enabled, "SleepTime",
  99.      {
  100.         "no Sleep",
  101.             noicon, nokey, nomark, plain;
  102.         "60 Ticks",
  103.             noicon, nokey, check, plain;
  104.     }
  105. };
  106.  
  107.  
  108.  
  109. /* this ALRT and DITL are used as an About screen */
  110.  
  111. resource 'ALRT' (rAboutAlert, purgeable) {
  112.     {40, 20, 160, 320},
  113.     rAboutAlert,
  114.     { /* array: 4 elements */
  115.         /* [1] */
  116.         OK, visible, silent,
  117.         /* [2] */
  118.         OK, visible, silent,
  119.         /* [3] */
  120.         OK, visible, silent,
  121.         /* [4] */
  122.         OK, visible, silent
  123.     }
  124. };
  125.  
  126. resource 'DITL' (rAboutAlert, purgeable) {
  127.     { /* array DITLarray: 5 elements */
  128.         /* [1] */
  129.         {88, 200, 108, 290},
  130.         Button {
  131.             enabled,
  132.             "OK"
  133.         },
  134.         /* [2] */
  135.         {8, 8, 24, 290},
  136.         StaticText {
  137.             disabled,
  138.             "A/ROSE Task under MultiFinder"
  139.         },
  140.         /* [3] */
  141.         {32, 8, 48, 290},
  142.         StaticText {
  143.             disabled,
  144.             "(derived from MPW:CExamples:Sample)"
  145.         },
  146.         /* [4] */
  147.         {56, 8, 72, 136},
  148.         StaticText {
  149.             disabled,
  150.             "Brought to you by:"
  151.         },
  152.         /* [5] */
  153.         {80, 24, 112, 167},
  154.         StaticText {
  155.             disabled,
  156.             "Joseph Maurer (EURO.DTS)"
  157.         }
  158.     }
  159. };
  160.  
  161.  
  162. /* this ALRT and DITL are used as an error screen */
  163.  
  164. resource 'ALRT' (rUserAlert, purgeable) {
  165.     {40, 250, 160, 510},
  166.     rUserAlert,
  167.     { /* array: 4 elements */
  168.         /* [1] */
  169.         OK, visible, silent,
  170.         /* [2] */
  171.         OK, visible, silent,
  172.         /* [3] */
  173.         OK, visible, silent,
  174.         /* [4] */
  175.         OK, visible, silent
  176.     }
  177. };
  178.  
  179.  
  180. resource 'DITL' (rUserAlert, purgeable) {
  181.     { /* array DITLarray: 3 elements */
  182.         /* [1] */
  183.         {80, 150, 100, 230},
  184.         Button {
  185.             enabled,
  186.             "OK"
  187.         },
  188.         /* [2] */
  189.         {10, 60, 60, 230},
  190.         StaticText {
  191.             disabled,
  192.             "^0."
  193.         },
  194.         /* [3] */
  195.         {8, 8, 40, 40},
  196.         Icon {
  197.             disabled,
  198.             2
  199.         }
  200.     }
  201. };
  202.  
  203. resource 'STR ' (rTaskName, purgeable) {
  204.  "myTaskName"
  205. };
  206.  
  207. resource 'STR ' (rTaskType, purgeable) {
  208.  "myTaskType"
  209. };
  210.  
  211.  
  212. resource 'STR#' (rErrStrings, purgeable) {
  213.     {
  214.     "You must run on 512Ke or later";
  215.     "Application Memory Size is too small";
  216.     "Not enough memory to run TaskSample";
  217.     "Cannot create window";
  218.     "Cannot use A/ROSE Prep";
  219.     "Task already registered";
  220.     "<GetMsg> failed";
  221.     "No Server task found";
  222.     "Problem with ICC Manager";
  223.     "Received message with unknown mCode";
  224.     "Received undeliverable message";
  225.     }
  226. };
  227.  
  228. resource 'STR#' (rWndStrings, purgeable) {
  229.     {
  230.     "OpenQueue returned: $";
  231.     "(this is my TID !)";
  232.     " Messages received: ";
  233.     " ............ sent: ";
  234.     }
  235. };
  236.  
  237.  
  238. resource 'WIND' (rWindow, preload, purgeable) {
  239.     {40, 260, 220, 500},
  240.     noGrowDocProc, visible, noGoAway, 0x0, "TaskSample"
  241. };
  242.  
  243.  
  244.  
  245. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  246.  
  247. resource 'SIZE' (-1) {
  248.     dontSaveScreen,
  249.     acceptSuspendResumeEvents,
  250.     enableOptionSwitch,
  251.     canBackground,                /* we can background; we don't currently, but our sleep value */
  252.                                 /* guarantees we don't hog the Mac while we are in the background */
  253.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  254.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  255.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  256.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  257.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  258.     reserved,
  259.     reserved,
  260.     reserved,
  261.     reserved,
  262.     reserved,
  263.     reserved,
  264.     reserved,
  265.     kPrefSize * 1024,
  266.     kMinSize * 1024    
  267. };
  268.